#ifndef _GUI_H_
#define _GUI_H_

#include <map>
#include "../../input/Keys.h"
#include <string>

// Forward declaration of Frame to reduce dependencies
class Frame;

typedef std::map<std::string, Frame*> FrameList;

/**
	Manager for all GUI related activites. Not a singleton so multiple managers are allowed
*/
class GUI {
	FrameList frames;			//The list of GUI frames to work with
	Frame* currentFrame;		//The currently active frame. Only one can be active at a time
	std::string initialFrame;	//The initial frame to start with
	
	bool doRollOvers;			//Whether to pass on rollover events
	bool enabled;				//If the gui is enabled

	//Don't start copying stuff around	
	GUI(const GUI&);
	GUI& operator=(const GUI&);
	
public:
	// Create a GUI with the given xml file in filename
	GUI(const char* filename = "");
	
	~GUI();
	
	//Destroys all gui resources
	void kill();
	
	//Loads a gui with the xml file at 'filename'
	bool load(const char* filename);
	
	//Enables the gui, switching to the initial frame
	void enable();
	//Disables the gui from drawing
	void disable();
	
	//Switches the control to the frame with the given name.
	//Enables the gui if it is not enabled
	bool switchToFrame(const std::string&);
	
	//Tells all frames to realign based on the new window size
	void onWindowResize(float, float);
	
	//Input dispatchers
	bool onMouseButtonDown(KEY_TYPE, int, int);
	void onMouseButtonUp(KEY_TYPE , int, int);
	
	bool onKeyDown(KEY_TYPE);
	void onKeyUp(KEY_TYPE);
	
	void onMouseMove(int, int);
};


#endif
